#include<string.h>

char *reformatNumber(char *number)
{
    int n = strlen(number);
    int i = 0;
    int j = 0;
    while (i < n)
    {
        if (number[i] != ' ' && number[i] != '-')
        {
            number[j] = number[i];
            j++;
        }
        i++;
    }
    int w = j;
    n = j;
    while (j < n)
    {
        number[j] = '\0';
        j++;
    }
    i = 0;
    j = 0;
    char *p = (char *)malloc(sizeof(char) * 1010);
    while (n)
    {
        if (n > 4)
        {
            for (int c = 0; c < 3; c++)
            {
                p[i] = number[j];
                i++;
                j++;
            }
            p[i++] = '-';
            n = n - 3;
        }
        else if (n == 4)
        {
            for (int c = 0; c < 2; c++)
            {
                p[i] = number[j];
                i++;
                j++;
            }
            n = n - 2;
            p[i++] = '-';
            for (int c = 0; c < 2; c++)
            {
                p[i] = number[j];
                i++;
                j++;
            }
            n = n - 2;
        }
        else if (n == 3)
        {
            for (int c = 0; c < 3; c++)
            {
                p[i] = number[j];
                i++;
                j++;
            }
            n = n - 3;
        }
        else if (n == 2)
        {
            for (int c = 0; c < 2; c++)
            {
                p[i] = number[j];
                i++;
                j++;
            }
            n = n - 2;
        }
    }
    p[i] = '\0';
    return p;
}